package com.cssw.fyzb.busi.service.system;

import com.cssw.fyzb.core.dao.system.SysParamDao;
import com.cssw.fyzb.core.model.dodb.SysParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;

/**
 * @author Feng Chen
 */
@Service
public class SysParamServiceImpl implements SysParamService {

    @Autowired
    private SysParamDao sysParamDao;

    @Override
    public SysParam findByCode(String paramCode) {
        return sysParamDao.findByCode(paramCode);
    }

    @Override
    public BigDecimal getRedPackAmountDown() {
        SysParam sysParam = sysParamDao.findByCode(SysParam.LIVE_RED_PACK_AMOUNT_DOWN);

        if (null != sysParam){
            return new BigDecimal(sysParam.getParamValue());
        }
        return null;
    }
}
